Reg DXL Script for one requirement?

Does anyone help me to write one DXL script ? I tried but could not suceed to complete the DXL script?

 

Requirement:

I need to extract the data from the attribute (attr1)which will be like  

B1.00

B2.00

B3.00

 

I need to extract the data from one more attribute which will be like

 

attr2 B1.01

 

I need to extract those two attributes and compare the data in the attribute

If  attr2 value ( numeric) is greater than or equal to i need to set another attribute to Boolean value.

 

Can anyone help me to complete the script?

 


DXLUserbsr - Fri May 03 16:35:10 EDT 2013

Re: Reg DXL Script for one requirement?
llandale - Sun May 05 13:53:14 EDT 2013

Let me scribble without any attempt at debugging.  I'll assume the entire attr values must have format "B1.00" without any additional characters (e.g. not "B1.001".

  • string   sValid =
    "^"           // beginning of string -
    "([A-Z])"    // match 1 a capital letter  -
    "("            // match 2 starts here.. -
    [1-9]      // a digit 1 through 9-
    \.            // a period -
    [0-9][0-9]    // two digits  -
    ")"        // match 2 ends here -
    "$"       // end of string
  • print "sValid = " sValid "\n"
  • Regexp reValid = regexp2(sValid)
  • bool CheckObject(Object obj)
  • {  string Value1 = obj."attr1"
  •    string Value2 = obj."attr2"
  •    if (reValid Value1)
  •    {  Letter1 = Value1[match 1]
  •       sValue1 = Value1[match 2]
  •       if (reValid Value2)
  •       { Letter2 = Value2[match 1]
  •          sValue2 = Value2[match 2]
  •          rValue1 = realOf(sValue1)
  •          rValue2 = realOf(sValue2)
  •          if (Letter1 == Letter2 and rValue2 >= rValue1) //
  •          then return(true)
  •          else return(false)
  •       }
  •       else return(false)
  •    }
  •    else return(false)
  • }  // end CheckObj()

-Louie